package com.lzy.pattern.observer.jdk;

/**
 * @ClassName: client
 * @Description: 在 Java 中，通过 java.util.Observable 类和 java.util.Observer 接口定义了观察者模式，只要实现它们的子类就可以编写观察者模式实例。
 * @Author: LiuZy
 * @Date: 2022/5/1 16:43
 * @Version: 1.0
 */
public class Client {

    public static void main(String[] args) {

        Police police = new Police("P001");
        Police police2 = new Police("P002");
        Police police3 = new Police("P003");

        Thief thief = new Thief("梁上飞");
        thief.addObserver(police);
        thief.addObserver(police2);
        thief.addObserver(police3);

        thief.steal();
    }
}